package io.kiki.sba.registry.server.metadata.bootstrap.config;

import io.kiki.sba.registry.util.OsUtils;
import org.springframework.boot.context.properties.ConfigurationProperties;


@ConfigurationProperties(prefix = MultiClusterMetaServerConfigBean.PREFIX)
public class MultiClusterMetaServerConfigBean implements MultiClusterMetaServerConfig {
    public static final String PREFIX = "meta.remote.server";

    private volatile int remoteMetaServerPort = 9617;

    private volatile int remoteClusterRpcTimeoutMillis = 3000;

    private volatile int multiClusterConfigReloadMillis = 60 * 1000;

    private volatile int multiClusterConfigReloadWorkerSize = 1;

    private volatile int multiClusterConfigReloadMaxBufferSize = 5;

    private volatile int remoteSlotSyncerMillis = 1000;

    private volatile int remoteSlotSyncerExecutorPoolSize = 10;

    private volatile int remoteSlotSyncerExecutorQueueSize = 100;

    private volatile int remoteClusterHandlerCoreSize = OsUtils.getCpuCount() * 3;

    private volatile int remoteClusterHandlerMaxSize = OsUtils.getCpuCount() * 3;

    private volatile int remoteClusterHandlerMaxBufferSize = 100;

    private volatile int clientManagerCoreSize = OsUtils.getCpuCount() * 3;

    private volatile int clientManagerMaxSize = OsUtils.getCpuCount() * 3;

    private volatile int clientManagerMaxBufferSize = 1000;

    @Override
    public int getRemoteSlotSyncerMillis() {
        return remoteSlotSyncerMillis;
    }


    public void setRemoteSlotSyncerMillis(int remoteSlotSyncerMillis) {
        this.remoteSlotSyncerMillis = remoteSlotSyncerMillis;
    }


    @Override
    public int getRemoteClusterRpcTimeoutMillis() {
        return remoteClusterRpcTimeoutMillis;
    }


    public void setRemoteClusterRpcTimeoutMillis(int remoteClusterRpcTimeoutMillis) {
        this.remoteClusterRpcTimeoutMillis = remoteClusterRpcTimeoutMillis;
    }


    @Override
    public int getRemoteMetaServerPort() {
        return remoteMetaServerPort;
    }


    public void setRemoteMetaServerPort(int remoteMetaServerPort) {
        this.remoteMetaServerPort = remoteMetaServerPort;
    }

    @Override
    public int getMultiClusterConfigReloadMillis() {
        return multiClusterConfigReloadMillis;
    }


    public void setMultiClusterConfigReloadMillis(int multiClusterConfigReloadMillis) {
        this.multiClusterConfigReloadMillis = multiClusterConfigReloadMillis;
    }

    @Override
    public int getMultiClusterConfigReloadWorkerSize() {
        return multiClusterConfigReloadWorkerSize;
    }


    public void setMultiClusterConfigReloadWorkerSize(int multiClusterConfigReloadWorkerSize) {
        this.multiClusterConfigReloadWorkerSize = multiClusterConfigReloadWorkerSize;
    }

    @Override
    public int getMultiClusterConfigReloadMaxBufferSize() {
        return multiClusterConfigReloadMaxBufferSize;
    }


    public void setMultiClusterConfigReloadMaxBufferSize(int multiClusterConfigReloadMaxBufferSize) {
        this.multiClusterConfigReloadMaxBufferSize = multiClusterConfigReloadMaxBufferSize;
    }

    @Override
    public int getRemoteClusterHandlerCoreSize() {
        return remoteClusterHandlerCoreSize;
    }


    public void setRemoteClusterHandlerCoreSize(int remoteClusterHandlerCoreSize) {
        this.remoteClusterHandlerCoreSize = remoteClusterHandlerCoreSize;
    }

    @Override
    public int getRemoteClusterHandlerMaxSize() {
        return remoteClusterHandlerMaxSize;
    }


    public void setRemoteClusterHandlerMaxSize(int remoteClusterHandlerMaxSize) {
        this.remoteClusterHandlerMaxSize = remoteClusterHandlerMaxSize;
    }

    @Override
    public int getRemoteClusterHandlerMaxBufferSize() {
        return remoteClusterHandlerMaxBufferSize;
    }


    public void setRemoteClusterHandlerMaxBufferSize(int remoteClusterHandlerMaxBufferSize) {
        this.remoteClusterHandlerMaxBufferSize = remoteClusterHandlerMaxBufferSize;
    }

    @Override
    public int getRemoteSlotSyncerExecutorPoolSize() {
        return remoteSlotSyncerExecutorPoolSize;
    }


    public void setRemoteSlotSyncerExecutorPoolSize(int remoteSlotSyncerExecutorPoolSize) {
        this.remoteSlotSyncerExecutorPoolSize = remoteSlotSyncerExecutorPoolSize;
    }

    @Override
    public int getRemoteSlotSyncerExecutorQueueSize() {
        return remoteSlotSyncerExecutorQueueSize;
    }


    public void setRemoteSlotSyncerExecutorQueueSize(int remoteSlotSyncerExecutorQueueSize) {
        this.remoteSlotSyncerExecutorQueueSize = remoteSlotSyncerExecutorQueueSize;
    }


    @Override
    public int getClientManagerCoreSize() {
        return clientManagerCoreSize;
    }


    public void setClientManagerCoreSize(int clientManagerCoreSize) {
        this.clientManagerCoreSize = clientManagerCoreSize;
    }

    @Override
    public int getClientManagerMaxSize() {
        return clientManagerMaxSize;
    }


    public void setClientManagerMaxSize(int clientManagerMaxSize) {
        this.clientManagerMaxSize = clientManagerMaxSize;
    }


    @Override
    public int getClientManagerMaxBufferSize() {
        return clientManagerMaxBufferSize;
    }

    public void setClientManagerMaxBufferSize(int clientManagerMaxBufferSize) {
        this.clientManagerMaxBufferSize = clientManagerMaxBufferSize;
    }
}
